package com.doubao.wechat.client;

import com.doubao.common.result.Result;
import com.doubao.wechat.dto.response.MembershipLevelDTO;
import com.doubao.wechat.dto.response.UserInfoResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 用户服务客户端
 */
@FeignClient(name = "doubao-user", path = "/user")
public interface UserServiceClient {

    /**
     * 获取用户信息
     *
     * @param userId 用户ID
     * @return 用户信息
     */
    @GetMapping("/info/{userId}")
    Result<UserInfoResponse> getUserInfo(@PathVariable("userId") Long userId);

    /**
     * 获取会员等级信息
     *
     * @param levelId 会员等级ID
     * @return 会员等级信息
     */
    @GetMapping("/membership/level/{levelId}")
    Result<MembershipLevelDTO> getMembershipLevelInfo(@PathVariable("levelId") Long levelId);

    /**
     * 激活会员
     *
     * @param userId 用户ID
     * @param levelId 会员等级ID
     * @param subscriptionType 订阅类型
     * @param days 有效天数
     * @param source 来源
     * @param orderNo 订单号
     * @return 结果
     */
    @PostMapping("/membership/activate")
    Result<Void> activateMembership(
            @RequestParam("userId") Long userId,
            @RequestParam("levelId") Integer levelId,
            @RequestParam("subscriptionType") String subscriptionType,
            @RequestParam("days") Integer days,
            @RequestParam("source") String source,
            @RequestParam("orderNo") String orderNo
    );
}